aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/pages/kodaira-data/events/[month].astro
blob: 1969ceec12f642c56604663285c289f7a51c3a5f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
---
// 月別アーカイブ(/kodaira-data/events/2026-11/ など)。
// 行事予定のデータ(src/data/schedule/*.json)から、その月の予定だけを静的に生成する。
import StarlightPage from '@astrojs/starlight/components/StarlightPage.astro';
import ScheduleTable from '@/components/ScheduleTable.astro';
import { monthKeys, monthLabel, rowsInMonth } from '@/lib/schedule-months';
import { SCHEDULE_BASE_PATH } from '@/data/schedule/config';

export function getStaticPaths() {
  return monthKeys.map((month, i) => ({
    params: { month },
    props: {
      month,
      prev: monthKeys[i - 1] ?? null,
      next: monthKeys[i + 1] ?? null,
    },
  }));
}

const { month, prev, next } = Astro.props as {
  month: string;
  prev: string | null;
  next: string | null;
};

const label = monthLabel(month);
const meetingRows = rowsInMonth(month, 'meeting');
const eventRows = rowsInMonth(month, 'event');

const url = (key: string) => `${SCHEDULE_BASE_PATH}${key}/`;
---

<StarlightPage
  frontmatter={{
    title: `小平市のイベント・行事予定(${label})`,
    description: `${label}の小平市のイベントと、審議会・市議会の開催予定の一覧です。日程・会場・申込期限を確認できます。`,
  }}
>
  <p><a href={SCHEDULE_BASE_PATH}>← 小平市のイベント・行事予定カレンダー(今後)に戻る</a></p>

  <p>
    {label}の小平市のイベントと、審議会等・市議会の開催予定です。開催日が過ぎたものも記録として掲載しています。
    変更になることがありますので、各問い合わせ先へご確認ください。
  </p>

  {
    meetingRows.length > 0 && (
      <>
        <h2>審議会等・市議会の開催予定</h2>
        <div class="schedule-table schedule-table--date-nowrap">
          <ScheduleTable variant="meeting" rows={meetingRows} />
        </div>
      </>
    )
  }

  {
    eventRows.length > 0 && (
      <>
        <h2>イベント</h2>
        <div class="schedule-table">
          <ScheduleTable variant="event" rows={eventRows} />
        </div>
      </>
    )
  }

  <nav class="schedule-month-nav" aria-label="月の移動">
    {prev ? <a href={url(prev)}>← {monthLabel(prev)}</a> : <span />}
    {next ? <a href={url(next)}>{monthLabel(next)} →</a> : <span />}
  </nav>
</StarlightPage>